<?php
namespace app\ai\model;

use think\Model;

class Base extends Model
{
   
    /*
     * @param   更新or自增 检测字段
     * @param   数据
     * @return  结果
     * */
    public function allowSave($field,$data){
        if(empty($this->where($field,$data[$field])->find())){
            $this->create($data);
            return true;
        }else{
            $this->where($field,$data[$field])->update($data);
            return true;
        }
        return false;
    }
}